import request from '../utils/request';

const AuthHeaders = {
    Authorization: localStorage.getItem('user')
}

// const url = "http://47.94.105.74:8080";

// export async function test(params) {
//     return request(`http://192.168.15.59:8000/api/getdata`, {
//         method: 'POST',
//         body: params
//     })
// }

//登录
export async function accountLogin(params) {
    return request('/api/system/user/login', {
        method: 'POST',
        body: params
    })
}

//登出
export async function logout() {
    return request('/api/system/user/logout', {
        headers: AuthHeaders,
        method: 'POST'
    })
}



//提示信息
export async function getTips() {
    return request(`/api/shouye/msg`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}




//获取菜单
export async function getMenu() {
    return request(`/api/system/menu/getMenus`, {
        headers: AuthHeaders,
        method: 'GET',
    })
}

//获取所有导航菜单
export async function getNavMenu() {
    return request(`/api/system/menu/getLeftMenus`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//添加菜单
export async function addMenu(params) {
    return request(`/api/system/menu/addMenu`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//修改菜单
export async function updateMenu(id,params) {
    return request(`/api/system/menu/updateMenu/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//删除菜单
export async function delMenu(params) {
    return request(`/api/system/menu/deleteMenus`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//修改web用户
export async function updateTown(id, params) {
    return request(`/api/address/update/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//查询web用户
export async function queryWebUser() {
    return request('/api/system/user/getAll', {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//查询所有web角色
export async function queryWebRole() {
    return request('/api/system/role/getAllForWeb', {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//添加web用户
export async function addWebUser(params) {
    return request('/api/system/user/add', {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}



//修改web用户
export async function updateWebRole(id, params) {
    return request(`/api/system/user/update/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//删除web用户
export async function delWebUser(params) {
    return request(`/api/system/user/delete/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}

//查询角色
export async function queryRole() {
    return request('/api/system/role/getAll', {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//添加角色
export async function addRole(params) {
    return request('/api/system/role/add', {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//删除角色
export async function delRole(params) {
    return request(`/api/system/role/delete/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}

//修改角色信息
export async function updateRole(id,params) {
    return request(`/api/system/role/update/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//获取角色权限
export async function getRoleMenu(params) {
    return request(`/api/system/role/getMenus/${params}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//修改角色权限
export async function updateMenus(id, params) {
    return request(`/api/system/role/updateMenus/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//获取操作日志
export async function getOperateLog(params) {
    return request(`/api/log/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//修改密码

export async function updatePwd(params) {
    return request(`/api/system/user/updatePassword`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//河长信息管理
export async function getHezhangInfo(params) {
    return request(`/api/base/riverChief/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//新增河长信息
export async function addHezhangInfo(params) {
    return request(`/api/base/riverChief/addOne`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//删除河长
export async function delHezhangInfo(params) {
    return request(`/api/base/riverChief/deleteOne/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}

//查询河长信息
export async function getSingleHezhangInfo(params) {
    return request(`/api/base/riverChief/getOne/${params}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//修改河长
export async function modHezhangInfo(id,params) {
    return request(`/api/base/riverChief/updateOne/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//获取行政区划
export async function getAdministrativeDivisions() {
    return request(`/api/system/system/administrativeArea/getAll`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//河流信息管理
export async function getRiverInfo(params) {
    return request(`/api/base/rivers/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}
//新增河流信息
export async function AddRiverInfo(params) {
    return request(`/api/base/rivers/addOne`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}
//删除河流信息
export async function delRiverInfo(params) {
    return request(`/api/base/rivers/deleteOne/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}
//查询某个河流的详细信息信息
export async function selectRiverInfo(params) {
    return request(`/api/base/rivers/getOne/${params}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}
//更新河流信息
export async function updateRiver(id,params) {
    return request(`/api/base/rivers/updateOne/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}
//水库信息管理
export async function getReservoirInfo(params) {
    return request(`/api/base/reservoir/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//湖泊信息管理
export async function getLakeInfo(params) {
    return request(`/api/base/lake/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//公示牌管理
export async function getBulletinBoard(params) {
    return request(`/api/base/bulletinBoard/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//增加公示牌
export async function addBulletinBoard(params) {
    return request(`/api/base/bulletinBoard/addOne`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//查询公示牌
export async function getSingleBulletinBoard(params) {
    return request(`/api/base/bulletinBoard/getOne/${params}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//修改公示牌
export async function modBulletinBoard(id,params) {
    return request(`/api/base/bulletinBoard/updateOne/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//删除公示牌
export async function delBulletinBoard(params) {
    return request(`/api/base/bulletinBoard/deleteOne/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}


//行政区划
export async function getAdministrativeArea() {
    return request(`/api/system/system/administrativeArea/getAll`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//查询下属行政区划
export async function getSubAdministrativeAreaId(param) {
    return request(`/api/system/system/administrativeArea/getChildren/${param}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//查询行政区划
export async function getAdministrativeAreaId(param) {
    return request(`/api/system/system/administrativeArea/getOne/${param}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}

//修改行政区划
export async function modAdministrativeArea(id,params) {
    return request(`/api/system/system/administrativeArea/updateOne/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//新增行政区划
export async function addAdministrativeArea(params) {
    return request(`/api/system/system/administrativeArea/addOne`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}


//删除行政区划
export async function delAdministrativeArea(params) {
    return request(`/api/system/system/administrativeArea/deleteOne/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}

//查询公告
export async function getNotice(params) {
    return request(`/api/content/notice/getAll`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

export async function getSingleNotice(param) {
    return request(`/api/content/notice/getOne/${param}`, {
        headers: AuthHeaders,
        method: 'GET'
    })
}


//新增公告
export async function addNotice(params) {
    return request(`/api/content/notice/add`, {
        headers: AuthHeaders,
        method: 'POST',
        body: params
    })
}

//更新河流信息
export async function updateNotice(id,params) {
    return request(`/api/content/notice/update/${id}`, {
        headers: AuthHeaders,
        method: 'PUT',
        body: params
    })
}

//删除公告
export async function delNotice(params) {
    return request(`/api/content/notice/delete/${params}`, {
        headers: AuthHeaders,
        method: 'DELETE'
    })
}